<?php
/**
 *
 * @Author 夸克
 * @Email 79517721@qq.com
 * @Description //TODO
 * @Date
 * @Version 1.0
 * @WebSite www.dashubaba.com
 * @AllRight 大树巴巴科技开发团队
 *
 **/
include './app/common.php';
$myKey = "20220305";//引号中的key可以修改为自己的内容
if(!isset($_GET['key']) || isset($_GET['key']) != $myKey){
    echo 0;exit;
}

$where = " where end_time = ".date('Y-m-d', strtotime(' +3 day'));//网站到期提醒时间 = 今日时间 + 到期前 3 天的 提醒

$bigAdList = $ADDB->query("SELECT t.*,curdate() as today FROM ad_big t $where     order by sort asc")->fetchAll();
$allAdQQ = "";

for($i =0;$i<count($bigAdList);$i++){
    $allAdQQ = $allAdQQ ."<br/>".$bigAdList[$i]['ad_qq'].'---大横幅广告';
}

$smallAdList = $ADDB->query("SELECT t.*,curdate() as today FROM ad_small t {$where}  order by sort asc")->fetchAll();
for($i =0;$i<count($smallAdList);$i++){
    $allAdQQ = $allAdQQ ."<br/>".$smallAdList[$i]['ad_qq'].'---小横幅广告';
}

$wordAdList = $ADDB->query("SELECT t.*,curdate() as today FROM ad_word t {$where}  order by sort asc")->fetchAll();
for($i =0;$i<count($wordAdList);$i++){
    $allAdQQ = $allAdQQ ."<br/>".$wordAdList[$i]['ad_qq'].'---文字广告';
}

if(!empty($allAdQQ)){
    $content = $allAdQQ."<br/>到期时间:".date('Y-m-d', strtotime(' + 3 day'));
    sendEmail($config['mail_name'],"即将到期的广告提醒",$content);
    echo '邮件发送成功';
    exit;
}
echo '暂时没有要到期的广告';